using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class DONVITINHInfo
    {
		#region Local Variable
		public enum Field
		{
			MADV,
			TENDV
		}
		private String _MADV;
		private String _TENDV;
		
		public String MADV{	get{ return _MADV;} set{_MADV = value;} }
		public String TENDV{	get{ return _TENDV;} set{_TENDV = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public DONVITINHInfo()
		{
			_MADV = "";
			_TENDV = "";
		}
		public DONVITINHInfo(
		String MADV,
		String TENDV
		)
		{
			_MADV = MADV;
			_TENDV = TENDV;
		}
		public DONVITINHInfo(DataRow dr)
		{
			if (dr != null)
			{
				_MADV = dr[Field.MADV.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MADV.ToString()]);
				_TENDV = dr[Field.TENDV.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENDV.ToString()]);
			}
		}
		public DONVITINHInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_MADV = dr[Field.MADV.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MADV.ToString()]);
				_TENDV = dr[Field.TENDV.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TENDV.ToString()]);
			}
		}
		public DONVITINHInfo(DONVITINHInfo objEntr)
		{			
			_MADV = objEntr.MADV;			
			_TENDV = objEntr.TENDV;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("DONVITINH");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.MADV.ToString(), typeof(String)),
				new DataColumn(Field.TENDV.ToString(), typeof(String))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.MADV.ToString()] = _MADV;
			row[Field.TENDV.ToString()] = _TENDV;
			return row;
		}
        #endregion InitTable
    }
}
